<!DOCTYPE html>
<html lang="en">
<head>
<title>WebView4Delphi: uWVTypeLibrary: Interface ICoreWebView2Controller</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="PasDoc 0.16.0-snapshot">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<span id="ICoreWebView2Controller"></span><h1 class="cio">Interface ICoreWebView2Controller</h1>
<div class="sections">
<div class="one_section"><a class="section" href="#PasDoc-Description">Description</a></div><div class="one_section"><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></div><div class="one_section">Fields</div><div class="one_section"><a class="section" href="#PasDoc-Methods">Methods</a></div><div class="one_section">Properties</div></div>
<span id="PasDoc-Description"></span><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="uWVTypeLibrary.html">uWVTypeLibrary</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type ICoreWebView2Controller = interface(IUnknown)</code></p>
<h2 class="description">Description</h2>
<p>
 The owner of the `CoreWebView2` object that provides support for resizing, showing and hiding, focusing, and other functionality related to windowing and composition. The `CoreWebView2Controller` owns the `CoreWebView2`, and if all references to the `CoreWebView2Controller` go away, the WebView is closed. </p>
<p>


<p>&lt;see href=&quot;<a href="https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controller">https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controller</a>&quot;&gt;See the ICoreWebView2Controller article.)</p>
<span id="PasDoc-Hierarchy"></span><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">IUnknown</li>
<li class="thisitem">ICoreWebView2Controller</li></ul><h2 class="overview">Overview</h2>
<span id="PasDoc-Methods"></span><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Get_IsVisible-Integer-">Get_IsVisible</a></strong>(out IsVisible: Integer): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Set_IsVisible-Integer-">Set_IsVisible</a></strong>(IsVisible: Integer): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Get_Bounds-tagRECT-">Get_Bounds</a></strong>(out Bounds: <a href="uWVTypeLibrary.html#tagRECT">tagRECT</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Set_Bounds-tagRECT-">Set_Bounds</a></strong>(Bounds: <a href="uWVTypeLibrary.html#tagRECT">tagRECT</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Get_ZoomFactor-Double-">Get_ZoomFactor</a></strong>(out ZoomFactor: Double): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Set_ZoomFactor-Double-">Set_ZoomFactor</a></strong>(ZoomFactor: Double): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#add_ZoomFactorChanged-ICoreWebView2ZoomFactorChangedEventHandler-EventRegistrationToken-">add_ZoomFactorChanged</a></strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2ZoomFactorChangedEventHandler.html">ICoreWebView2ZoomFactorChangedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#remove_ZoomFactorChanged-EventRegistrationToken-">remove_ZoomFactorChanged</a></strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#SetBoundsAndZoomFactor-tagRECT-Double-">SetBoundsAndZoomFactor</a></strong>(Bounds: <a href="uWVTypeLibrary.html#tagRECT">tagRECT</a>; ZoomFactor: Double): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#MoveFocus-COREWEBVIEW2_MOVE_FOCUS_REASON-">MoveFocus</a></strong>(reason: <a href="uWVTypeLibrary.html#COREWEBVIEW2_MOVE_FOCUS_REASON">COREWEBVIEW2_MOVE_FOCUS_REASON</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#add_MoveFocusRequested-ICoreWebView2MoveFocusRequestedEventHandler-EventRegistrationToken-">add_MoveFocusRequested</a></strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2MoveFocusRequestedEventHandler.html">ICoreWebView2MoveFocusRequestedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#remove_MoveFocusRequested-EventRegistrationToken-">remove_MoveFocusRequested</a></strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#add_GotFocus-ICoreWebView2FocusChangedEventHandler-EventRegistrationToken-">add_GotFocus</a></strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2FocusChangedEventHandler.html">ICoreWebView2FocusChangedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#remove_GotFocus-EventRegistrationToken-">remove_GotFocus</a></strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#add_LostFocus-ICoreWebView2FocusChangedEventHandler-EventRegistrationToken-">add_LostFocus</a></strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2FocusChangedEventHandler.html">ICoreWebView2FocusChangedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#remove_LostFocus-EventRegistrationToken-">remove_LostFocus</a></strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#add_AcceleratorKeyPressed-ICoreWebView2AcceleratorKeyPressedEventHandler-EventRegistrationToken-">add_AcceleratorKeyPressed</a></strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2AcceleratorKeyPressedEventHandler.html">ICoreWebView2AcceleratorKeyPressedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#remove_AcceleratorKeyPressed-EventRegistrationToken-">remove_AcceleratorKeyPressed</a></strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Get_ParentWindow-HWND-">Get_ParentWindow</a></strong>(out ParentWindow: HWND): HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Set_ParentWindow-HWND-">Set_ParentWindow</a></strong>(ParentWindow: HWND): HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#NotifyParentWindowPositionChanged">NotifyParentWindowPositionChanged</a></strong>: HResult; stdcall;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Close">Close</a></strong>: HResult; stdcall;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <strong><a href="uWVTypeLibrary.ICoreWebView2Controller.html#Get_CoreWebView2-ICoreWebView2-">Get_CoreWebView2</a></strong>(out CoreWebView2: <a href="uWVTypeLibrary.ICoreWebView2.html">ICoreWebView2</a>): HResult; stdcall;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Get_IsVisible-Integer-"></span><code>function <strong>Get_IsVisible</strong>(out IsVisible: Integer): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 The `IsVisible` property determines whether to show or hide the WebView2. If `IsVisible` is set to `FALSE`, the WebView2 is transparent and is not rendered. However, this does not affect the window containing the WebView2 (the `HWND` parameter that was passed to `CreateCoreWebView2Controller`). If you want that window to disappear too, run `ShowWindow` on it directly in addition to modifying the `IsVisible` property. WebView2 as a child window does not get window messages when the top window is minimized or restored. For performance reasons, developers should set the `IsVisible` property of the WebView to `FALSE` when the app window is minimized and back to `TRUE` when the app window is restored. The app window does this by handling `SIZE_MINIMIZED and SIZE_RESTORED` command upon receiving `WM_SIZE` message.

<p>There are CPU and memory benefits when the page is hidden. For instance, Chromium has code that throttles activities on the page like animations and some tasks are run less frequently. Similarly, WebView2 will purge some caches to reduce memory usage.

<p>\snippet ViewComponent.cpp ToggleIsVisible </p>
<h6 class="description_section">Attributes</h6>
<dl class="attributes">
  <dt>GUID['{4D00C0D1-9434-4EB6-8078-8697A560334F}']</dt>
  <dd></dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Set_IsVisible-Integer-"></span><code>function <strong>Set_IsVisible</strong>(IsVisible: Integer): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Sets the `IsVisible` property.

<p>\snippet ViewComponent.cpp ToggleIsVisibleOnMinimize </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Get_Bounds-tagRECT-"></span><code>function <strong>Get_Bounds</strong>(out Bounds: <a href="uWVTypeLibrary.html#tagRECT">tagRECT</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 The WebView bounds. Bounds are relative to the parent `HWND`. The app has two ways to position a WebView.

<p>* Create a child `HWND` that is the WebView parent `HWND`. Position the window where the WebView should be. Use `(0, 0)` for the top-left corner (the offset) of the `Bounds` of the WebView. * Use the top-most window of the app as the WebView parent HWND. For example, to position WebView correctly in the app, set the top-left corner of the Bound of the WebView.

<p>The values of `Bounds` are limited by the coordinate space of the host. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Set_Bounds-tagRECT-"></span><code>function <strong>Set_Bounds</strong>(Bounds: <a href="uWVTypeLibrary.html#tagRECT">tagRECT</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Sets the `Bounds` property.

<p>\snippet ViewComponent.cpp ResizeWebView </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Get_ZoomFactor-Double-"></span><code>function <strong>Get_ZoomFactor</strong>(out ZoomFactor: Double): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 The zoom factor for the WebView.

<p>\&gt; [!NOTE]\n\&gt; Changing zoom factor may cause `window.innerWidth`, `window.innerHeight`, both, and page layout to change. A zoom factor that is applied by the host by running `ZoomFactor` becomes the new default zoom for the WebView. The zoom factor applies across navigations and is the zoom factor WebView is returned to when the user chooses Ctrl+0. When the zoom factor is changed by the user (resulting in the app receiving `ZoomFactorChanged`), that zoom applies only for the current page. Any user applied zoom is only for the current page and is reset on a navigation. Specifying a `zoomFactor` less than or equal to `0` is not allowed. WebView also has an internal supported zoom factor range. When a specified zoom factor is out of that range, it is normalized to be within the range, and a `ZoomFactorChanged` event is triggered for the real applied zoom factor. When the range normalization happens, the `ZoomFactor` property reports the zoom factor specified during the previous modification of the `ZoomFactor` property until the `ZoomFactorChanged` event is received after WebView applies the normalized zoom factor. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Set_ZoomFactor-Double-"></span><code>function <strong>Set_ZoomFactor</strong>(ZoomFactor: Double): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Sets the `ZoomFactor` property. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="add_ZoomFactorChanged-ICoreWebView2ZoomFactorChangedEventHandler-EventRegistrationToken-"></span><code>function <strong>add_ZoomFactorChanged</strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2ZoomFactorChangedEventHandler.html">ICoreWebView2ZoomFactorChangedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Adds an event handler for the `ZoomFactorChanged` event. `ZoomFactorChanged` runs when the `ZoomFactor` property of the WebView changes. The event may run because the `ZoomFactor` property was modified, or due to the user manually modifying the zoom. When it is modified using the `ZoomFactor` property, the internal zoom factor is updated immediately and no `ZoomFactorChanged` event is triggered. WebView associates the last used zoom factor for each site. It is possible for the zoom factor to change when navigating to a different page. When the zoom factor changes due to a navigation change, the `ZoomFactorChanged` event runs right after the `ContentLoading` event.

<p>\snippet ViewComponent.cpp ZoomFactorChanged </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="remove_ZoomFactorChanged-EventRegistrationToken-"></span><code>function <strong>remove_ZoomFactorChanged</strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Remove an event handler previously added with `add_ZoomFactorChanged`. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="SetBoundsAndZoomFactor-tagRECT-Double-"></span><code>function <strong>SetBoundsAndZoomFactor</strong>(Bounds: <a href="uWVTypeLibrary.html#tagRECT">tagRECT</a>; ZoomFactor: Double): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Updates `Bounds` and `ZoomFactor` properties at the same time. This operation is atomic from the perspective of the host. After returning from this function, the `Bounds` and `ZoomFactor` properties are both updated if the function is successful, or neither is updated if the function fails. If `Bounds` and `ZoomFactor` are both updated by the same scale (for example, `Bounds` and `ZoomFactor` are both doubled), then the page does not display a change in `window.innerWidth` or `window.innerHeight` and the WebView renders the content at the new size and zoom without intermediate renderings. This function also updates just one of `ZoomFactor` or `Bounds` by passing in the new value for one and the current value for the other.

<p>\snippet ViewComponent.cpp SetBoundsAndZoomFactor </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="MoveFocus-COREWEBVIEW2_MOVE_FOCUS_REASON-"></span><code>function <strong>MoveFocus</strong>(reason: <a href="uWVTypeLibrary.html#COREWEBVIEW2_MOVE_FOCUS_REASON">COREWEBVIEW2_MOVE_FOCUS_REASON</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Moves focus into WebView. WebView gets focus and focus is set to correspondent element in the page hosted in the WebView. For Programmatic reason, focus is set to previously focused element or the default element if no previously focused element exists. For `Next` reason, focus is set to the first element. For `Previous` reason, focus is set to the last element. WebView changes focus through user interaction including selecting into a WebView or Tab into it. For tabbing, the app runs MoveFocus with Next or Previous to align with Tab and Shift+Tab respectively when it decides the WebView is the next element that may exist in a tab. Or, the app runs `IsDialogMessage` as part of the associated message loop to allow the platform to auto handle tabbing. The platform rotates through all windows with `WS_TABSTOP`. When the WebView gets focus from `IsDialogMessage`, it is internally put the focus on the first or last element for tab and Shift+Tab respectively.

<p>\snippet App.cpp MoveFocus0

<p>\snippet ControlComponent.cpp MoveFocus1

<p>\snippet ControlComponent.cpp MoveFocus2 </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="add_MoveFocusRequested-ICoreWebView2MoveFocusRequestedEventHandler-EventRegistrationToken-"></span><code>function <strong>add_MoveFocusRequested</strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2MoveFocusRequestedEventHandler.html">ICoreWebView2MoveFocusRequestedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Adds an event handler for the `MoveFocusRequested` event. `MoveFocusRequested` runs when user tries to tab out of the WebView. The focus of the WebView has not changed when this event is run.

<p>\snippet ControlComponent.cpp MoveFocusRequested </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="remove_MoveFocusRequested-EventRegistrationToken-"></span><code>function <strong>remove_MoveFocusRequested</strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Removes an event handler previously added with `add_MoveFocusRequested`. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="add_GotFocus-ICoreWebView2FocusChangedEventHandler-EventRegistrationToken-"></span><code>function <strong>add_GotFocus</strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2FocusChangedEventHandler.html">ICoreWebView2FocusChangedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Adds an event handler for the `GotFocus` event. `GotFocus` runs when WebView has focus. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="remove_GotFocus-EventRegistrationToken-"></span><code>function <strong>remove_GotFocus</strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Removes an event handler previously added with `add_GotFocus`. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="add_LostFocus-ICoreWebView2FocusChangedEventHandler-EventRegistrationToken-"></span><code>function <strong>add_LostFocus</strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2FocusChangedEventHandler.html">ICoreWebView2FocusChangedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Adds an event handler for the `LostFocus` event. `LostFocus` runs when WebView loses focus. In the case where `MoveFocusRequested` event is run, the focus is still on WebView when `MoveFocusRequested` event runs. `LostFocus` only runs afterwards when code of the app or default action of `MoveFocusRequested` event set focus away from WebView. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="remove_LostFocus-EventRegistrationToken-"></span><code>function <strong>remove_LostFocus</strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Removes an event handler previously added with `add_LostFocus`. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="add_AcceleratorKeyPressed-ICoreWebView2AcceleratorKeyPressedEventHandler-EventRegistrationToken-"></span><code>function <strong>add_AcceleratorKeyPressed</strong>(const eventHandler: <a href="uWVTypeLibrary.ICoreWebView2AcceleratorKeyPressedEventHandler.html">ICoreWebView2AcceleratorKeyPressedEventHandler</a>; out token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Adds an event handler for the `AcceleratorKeyPressed` event. `AcceleratorKeyPressed` runs when an accelerator key or key combo is pressed or released while the WebView is focused. A key is considered an accelerator if either of the following conditions are true.

<p>* Ctrl or Alt is currently being held. * The pressed key does not map to a character.

<p>A few specific keys are never considered accelerators, such as Shift. The `Escape` key is always considered an accelerator.

<p>Auto-repeated key events caused by holding the key down also triggers this event. Filter out the auto-repeated key events by verifying the `KeyEventLParam` or `PhysicalKeyStatus` event args.

<p>In windowed mode, the event handler is run synchronously. Until you run `Handled()` on the event args or the event handler returns, the browser process is blocked and outgoing cross-process COM requests fail with `RPC_E_CANTCALLOUT_ININPUTSYNCCALL`. All `CoreWebView2` API methods work, however.

<p>In windowless mode, the event handler is run asynchronously. Further input do not reach the browser until the event handler returns or `Handled()` is run, but the browser process is not blocked, and outgoing COM requests work normally.

<p>It is recommended to run `Handled(TRUE)` as early as are able to know that you want to handle the accelerator key.

<p>\snippet ControlComponent.cpp AcceleratorKeyPressed </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="remove_AcceleratorKeyPressed-EventRegistrationToken-"></span><code>function <strong>remove_AcceleratorKeyPressed</strong>(token: <a href="uWVTypeLibrary.EventRegistrationToken.html">EventRegistrationToken</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Removes an event handler previously added with `add_AcceleratorKeyPressed`. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Get_ParentWindow-HWND-"></span><code>function <strong>Get_ParentWindow</strong>(out ParentWindow: HWND): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
* ParentWindow: wireHWND &ndash;&gt; ParentWindow: HWND ************** WEBVIEW4DELPHI ************** *</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Set_ParentWindow-HWND-"></span><code>function <strong>Set_ParentWindow</strong>(ParentWindow: HWND): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
* ParentWindow: wireHWND &ndash;&gt; ParentWindow: HWND ************** WEBVIEW4DELPHI ************** *</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="NotifyParentWindowPositionChanged"></span><code>function <strong>NotifyParentWindowPositionChanged</strong>: HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 This is a notification separate from `Bounds` that tells WebView that the main WebView parent (or any ancestor) `HWND` moved. This is needed for accessibility and certain dialogs in WebView to work correctly.

<p>\snippet ViewComponent.cpp NotifyParentWindowPositionChanged </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Close"></span><code>function <strong>Close</strong>: HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Closes the WebView and cleans up the underlying browser instance. Cleaning up the browser instance releases the resources powering the WebView. The browser instance is shut down if no other WebViews are using it.

<p>After running `Close`, most methods will fail and event handlers stop running. Specifically, the WebView releases the associated references to any associated event handlers when `Close` is run.

<p>`Close` is implicitly run when the `CoreWebView2Controller` loses the final reference and is destructed. But it is best practice to explicitly run `Close` to avoid any accidental cycle of references between the WebView and the app code. Specifically, if you capture a reference to the WebView in an event handler you create a reference cycle between the WebView and the event handler. Run `Close` to break the cycle by releasing all event handlers. But to avoid the situation, it is best to both explicitly run `Close` on the WebView and to not capture a reference to the WebView to ensure the WebView is cleaned up correctly. `Close` is synchronous and won't trigger the `beforeunload` event.

<p>\snippet AppWindow.cpp Close </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img  src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><span id="Get_CoreWebView2-ICoreWebView2-"></span><code>function <strong>Get_CoreWebView2</strong>(out CoreWebView2: <a href="uWVTypeLibrary.ICoreWebView2.html">ICoreWebView2</a>): HResult; stdcall;</code></td>
</tr>
<tr><td colspan="2">
<p>
 Gets the `CoreWebView2` associated with this `CoreWebView2Controller`. </p>
</td></tr>
</table>
<hr><span class="appinfo"><em>Generated by <a href="https://pasdoc.github.io/">PasDoc 0.16.0-snapshot</a>. </em>
</span>
</body></html>
